<include file="public:header" />
  <div class="toptip">
    <h2>提示：</h2>
    <p>
      系统将自动取消到期的企业推广。<br />
    </p>
  </div>
  <div class="toptit">新增推广</div>
    <form id="form1" name="form1" method="post" action="{:U('add')}">
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="link_lan">
        <tr>
          <td width="350" valign="top"><table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#F4FDFF"   class="link_lan"  style="border-bottom:1px #B4E0ED solid;border-top:1px #B4E0ED solid;border-left:1px #B4E0ED solid;">
            <tr>
              <td height="32" align="right"  class="trcolor" >请输入职位ID：</td>
              <td width="215"  class="trcolor" ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_id" maxlength="25" value=""/></td>
            </tr>
            <tr>
              <td height="32" align="right"  class="trcolor"  >或职位名称：</td>
              <td class="trcolor"  ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_jobname" maxlength="25" value=""/></td>
            </tr>
            <tr>
              <td height="32" align="right" class="trcolor"  >或企业名称：</td>
              <td   class="trcolor"  ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_comname" maxlength="25" value=""/></td>
            </tr>
            <tr>
              <td height="32" align="right" class="trcolor"  >或会员ID：</td>
              <td   class="trcolor"  ><input name="admin_name" type="text" class="input_text_200 getinfo" id="get_uid" maxlength="25" value=""/></td>
            </tr>
          </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="3" class="link_lan">
            
            <tr>
              <td height="35" align="right" >推广期限(天)：</td>
              <td ><input name="cp_days"  id="days" type="text" class="input_text_200"   maxlength="3" value=""/></td>
            </tr>
            <tr>
              <td height="35" align="right"  >推广方案：</td>
              <td width="215">
                <select name="cp_ptype" id="cp_ptype">
                  <option value="-1">请选择推广方案</option>
                  <option value="stick">职位置顶</option>
                  <option value="emergency">职位紧急</option>
                </select>
              </td>
              </tr>
                <tr>
                  <td height="35" align="right"  >&nbsp;</td>
                  <td height="60"  ><input name="submit3" type="button" class="admin_submit"   id="ADD"  value="确定"/>
                  <input name="submit22" type="button" class="admin_submit"    value="返回" onclick="Javascript:window.history.go(-1)"/></td>
                </tr>
                <tr>
                  <td height="35" align="right"  >&nbsp;</td>
                  <td height="60"  >&nbsp;</td>
                </tr>
              </table>
                
              </td>
              <td valign="top" >
                <table width="100%" border="0" cellspacing="0" cellpadding="0" >
                  <tr>
                    <td style="border:1px  #B4E0ED solid; height:152px;" id="showtd"  bgcolor="#FFFFFF"  valign="top">
                      <div style="padding:15px; color: #0066CC">请在左侧表单中输入你要查找的值。</div>
                    </td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>
        </form>
      </div>
<include file="public:footer" />
<script type="text/javascript">
$(document).ready(function()
{
  $("input.getinfo").focus(function()
  {
  $(".trcolor").css("background-color","");
  $(this).parent().parent().find("td").filter(".trcolor").css("background-color","#E3F3FB");
  });
  
  $("#get_id,#get_jobname,#get_comname,#get_uid").keyup(function(){
  if($(this).val())
  {
    var tsTimeStamp= new Date().getTime();
    $.get("{:U('ajax_get_jobs')}", {"tstime":tsTimeStamp,"key":$(this).val(),"type":$(this).attr("id")},
    function (data)
      {
      if (data)
      {
        html="<table width=\"100%\" border=\"0\" cellpadding=\"4\" cellspacing=\"0\" style=\"margin-bottom:10px;\" >";
        html+="<tr>";
        html+="<td width=\"25%\" height=\"28\" bgcolor=\"#EBF7FC\"  >&nbsp;&nbsp;&nbsp;&nbsp;<strong>职位名称<\/strong><\/td>";
        html+="<td bgcolor=\"#EBF7FC\"  ><strong>公司名称<\/strong><\/td>";
        html+="<td width=\"13%\" align=\"center\" bgcolor=\"#EBF7FC\"  ><strong>发布时间<\/strong><\/td>";
        html+="<td width=\"13%\" align=\"center\" bgcolor=\"#EBF7FC\"  ><strong>到期时间<\/strong><\/td>";
        html+="<td width=\"13%\" align=\"center\" bgcolor=\"#EBF7FC\"  ><strong>刷新时间<\/strong><\/td>";
        html+="<\/tr>";
        var str=data.split("@@@");
        var i=1;
        for (x in str)
        {
          var val=str[x].split("%%%");
          html+="<tr>";
          html+="<td height=\"20\" style=\"border-bottom:1px #B4E0ED dashed\" >&nbsp;";
          html+="<label>";
          html+="<input type=\"radio\" name=\"cp_jobid\" value=\""+val[0]+"\" \/>";
          html+="<\/label>";
          html+="<a href=\""+val[2]+"\" target=\"_blank\">"+val[1]+"<\/a><\/td>";
          html+="<td  style=\"border-bottom:1px #B4E0ED dashed\"><a href=\""+val[4]+"\" target=\"_blank\">"+val[3]+"<\/a><\/td>";
          html+="<td align=\"center\"  style=\"border-bottom:1px  #B4E0ED dashed\">"+val[5]+"<\/td>";
          html+="<td align=\"center\"  style=\"border-bottom:1px #B4E0ED dashed\">"+val[6]+"<\/td>";
          html+="<td align=\"center\"  style=\"border-bottom:1px #B4E0ED dashed\">"+val[7]+"<\/td>";
          html+="<\/tr>";
          i++;
        }
        html+="<\/table>";
        $("#showtd").html(html);
      }
      else
      {
      html="<div style=\"padding:15px; color:#0066CC\">没有找到对应的职位。</div>";
      $("#showtd").html(html);
      }
    })
    }
  }); 
  //点击批量取消
  $("#ADD").on('click',function(){
    var flag = false;
    $("input[name='cp_jobid']").each(function(index)
    {
      if($(this).is(":checked")){
        flag = true;
      }
    });
    if(!flag){
      alert("请选择要推广的职位");
      return false;
    };
      if ($("#promotionid").val()=='-1')
      {
        alert("请选择要推广方案");
        $("#promotionid").focus();
    return false;
      }
      else if ($("#days").val()=="")
      {
        alert("请填写推广天数");
        $("#days").focus();
          return false;
      }
      $("form[name=form1]").submit();
    });
  });
  </script>
    </body>
  </html>